Repository navigation
Geo exclusions and ad schedule on draft_campaign and update_campaign - #121
Merged
kLOsk merged 2 commits intoNov 12, 2026
Merged
Conversation
Owner
|
Thanks, the replace semantics and the re-check at apply look right. Answers and next steps:
|
draft_campaign puts them in the campaign's atomic mutate. update_campaign replaces the whole list: omitted leaves it, [] clears it. The preview shows the current values and apply refuses if they changed after it; only the entries that differ are removed or added. Windows use add_ad_schedule's validation. A first schedule and clearing a schedule need a double confirmation, as does dropping a geo exclusion.
The campaign is created PAUSED, so a schedule stops nothing from serving, and the dialog's "cannot be undone" was wrong there. The preview now says the campaign serves only inside the windows once it is enabled. update_campaign keeps the double confirmation for a first schedule, for clearing a schedule and for dropping an exclusion. Tests pin the order of the one update_campaign request: campaign fields, exclusion removes, positive geo removes and creates, languages, exclusion creates, schedule removes, then schedule creates. A location moving from the exclusions to the targets, or back, is removed before it is created again, and keyword_match_type (kLOsk#117) can go in the same request. The GA4 annotation suggested after an applied update_campaign now counts exclusions as targeting and names a schedule change. The rules and tool descriptions describe the final behavior.
illia-sapryga
force-pushed
the
feat/campaign-geo-exclude-schedule
branch
from
November 10, 2026 22:01
0a114a5 to
776754c
Compare
Contributor
Author
|
Thanks, Daniel. Rebased onto main and added 776754c:
The description is updated to match. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Today a new campaign needs follow-up plans for its exclusions and its schedule:
add_negative_locationsandadd_ad_schedule, each previewed and applied after the campaign exists. There is also no way to say "this is the complete list" on an existing campaign. You have to work out the difference yourself and go throughremove_entityone criterion at a time.This adds
geo_exclude_idsandad_scheduleto both tools, as parameters rather than new tools.On
draft_campaignthey go in the campaign's atomic mutate, so a failure leaves nothing behind.On
update_campaignthey replace the whole list: omitted leaves it,[]clears it. The preview showscurrent_geo_exclude_idsandcurrent_ad_schedule, and apply re-reads them and refuses if they moved after the preview. Only the entries that differ are removed or added, so a window or exclusion that stays keeps its criterion and history. Exclusion removals go before the positive geo operations and exclusion creates after them, so a location can move between the two lists in one request. One request goes: campaign fields, exclusion removals, positive location removals and creates, languages, exclusion creates, then schedule removals before schedule creates;TestOneRequestOrderpins that order, includingkeyword_match_type(#117) in the same request.Windows go through
_validate_schedule, so the rules are the onesadd_ad_schedulehas. Onupdate_campaignthese need a double confirmation:add_ad_schedule's logic and warning text (now a shared helper)On
draft_campaigna schedule only adds a warning: the campaign is created PAUSED, so nothing stops serving, and the preview says it will serve only inside the windows once it is enabled.When
geo_exclude_idsis passed next togeo_target_ids, the "negative exclusions will be preserved" warning no longer appears, since they are being replaced. A list with a blank entry is refused, so[" "]can't quietly clear the exclusions. Passing the values a campaign already has comes back as nothing to change.What it does not do:
add_negative_locationsandadd_ad_schedulestay as they are, for adding to what's there. An exclusion that overlapsgeo_target_idsin the same call is refused, but an overlap with the campaign's existing positive targets is left to Google's answer in the dry run.Tested with the full suite plus
tests/test_campaign_geo_exclude_schedule.py. Plans run throughconfirm_and_apply(dry_run=True)with real protos and the real validate-only wrapper, and fake services that only record the request. GAQL reads are stubbed. I have not run this code against a live account, so Google's answer to the replacement requests is untested, including the removal order.Rebased onto main (0.41.2), next to #117's
keyword_match_type.